import { BaseMgr } from "../base/BaseMgr";
import StateMachine from "../fsm/StateMatchine";

export default class ProcedureMgr extends BaseMgr {
    private _stateMachine: StateMachine = new StateMachine();
    public static get inst() {
        return this.getInstance();
    }

    /** 注册流程 */
    registerProcedure(name: string | number, cls: IState) {
        console.log(`%c注册流程 ==> ${name}`, `color:#0f0`);
        this._stateMachine.registerState(name, cls);
    }

    /** 更改流程 */
    changeState(name: string | number) {
        return this._stateMachine.changeState(name);
    }

    update(dt: number) {
        this._stateMachine.update(dt);
    }
}